package com.base.common.properties;

import com.base.common.ConfigConstants;
import com.base.common.utils.ReadJarUtil;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 加载config.properties
 * 
 * @author Kevin Colin
 *
 */
public class ConfigLoad {
	private static String		propertiesPath	= "config.properties";
	private static Properties	props=null;
	static
	{
		try
		{
			props = new Properties();
			InputStream inputStream = ReadJarUtil.getInputStream(propertiesPath);
			props.load(inputStream);
			inputStream.close();
			
		}catch(IOException e)
		{
			e.printStackTrace();
		}
	}
	public void init() {
		ConfigConstants.SERVERIP = props.getProperty("serverIP");
		ConfigConstants.MESSAGE_NAME = props.getProperty("message_name");
		ConfigConstants.MESSAGE_PWD = props.getProperty("message_pwd");
		ConfigConstants.MESSAGE_URL = props.getProperty("message_url");
		ConfigConstants.MESSAGE_USER_ID = props.getProperty("message_user_id");
		ConfigConstants.INFOS_LIST_NUM = props.getProperty("infos_list_num");
		ConfigConstants.TICKET_CODE_NUMS = props.getProperty("ticketCodeNums");
		ConfigConstants.PROJECT_NAME = props.getProperty("project_name");
		ConfigConstants.SERVERNAME = props.getProperty("serverName");
	}
}
